package com.assignwork.modules.pc;
import com.assignwork.dto.pcplan.PcShipEfficiencySubmitDto;
import com.assignwork.modules.pc.service.pc.IPcShipEfficiencyService;
import com.assignwork.vo.pc.PcShipEfficiencyVo;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @ClassName PcShipEfficiencyController
 * @Description 泊位船时效率
 */

@RestController
@RequestMapping("pcShipEfficiency")
@AllArgsConstructor
@Api(value = "泊位船时效率", tags = "泊位船时效率")
public class PcShipEfficiencyController extends BladeController {
    private IPcShipEfficiencyService service;

    @PostMapping("/submit")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "新增或修改", notes = "传入entity")
    public R<Boolean> submitPcShipEfficiency(@Valid @RequestBody PcShipEfficiencySubmitDto submitDTO) {
        return R.status(service.submitPcShipEfficiency(submitDTO));
    }

    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "列表", notes = "传入dto")
    public R<List<PcShipEfficiencyVo>> selectPcShipEfficiencyList() {
        List<PcShipEfficiencyVo> data = service.selectPcShipEfficiencyList();
        return R.data(data);
    }

    @PostMapping("/remove")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "删除", notes = "传入id")
    public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String id) {
        return R.status(service.deleteLogic(Func.toLongList(id)));
    }
}
